int sumOddLengthSubarrays(int* arr, int arrSize){
    //计算数组前缀和
    int prefixSum[arrSize + 1];
    prefixSum[0] = 0;
    for (int i = 0; i < arrSize; i++) {
        prefixSum[i + 1] = prefixSum[i] + arr[i];
    }

    int sum = 0;

    // 遍历数组
    for (int i = 0; i < arrSize; i++) {
        // 计算以当前元素为中心的奇数长度的子数组
        for (int len = 1; i + len <= arrSize; len += 2) {
            int start = i;
            int end = i + len;

            // 使用前缀和数组计算子数组的和
            sum += prefixSum[end] - prefixSum[start];
        }
    }

    return sum;
}